/*
 * WorkerInfo.java
 *
 * $Id: WorkerInfo.java,v 1.1 2008-03-18 12:58:46 mario Exp $
 */
package org.ceteca.explica.core.traceability.tree;

/**
 * ValueObject with the data of a Worker item.
 * <br/>
 * Responsibilities:
 * <ul>
 *  <li>Store the worker data.</li>
 * </ul>
 * <br/>
 * @author Mario García García <mario@imagos.es>
 * Copyright (c) 2007 Fundación Centro Tecnolóxico da Carne
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <br/>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <br/>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
public class WorkerInfo {
	/** Worker code */
	private String codWorker;
	/** Worker name */
	private String description;
	
	/** 
	 * Default WorkerInfo constructor 
	 */
	public WorkerInfo() {
		this.setCodWorker(null);
		this.setDescription(null);
	}
	
	/**
	 * WorkerInfo constructor that initializes the worker values.
	 * @param codWorker String, worker code.
	 * @param description String, worker name.
	 */
	public WorkerInfo(String codWorker, String description) {
		this.setCodWorker(codWorker);
		this.setDescription(description);
	}
	
	/**
	 * Gets the worker name.
	 * @return String, worker name.
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * Sets up the worker name.
	 * @param description String, a name.
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * Gets the worker code.
	 * @return String, worker code.
	 */
	public String getCodWorker() {
		return codWorker;
	}
	/**
	 * Sets up the worker code.
	 * @param codWorker String, a worker code.
	 */
	public void setCodWorker(String codWorker) {
		this.codWorker = codWorker;
	}
	
	/**
	 * Converts the worker info to a formatted String.
	 * @return String, formatted String with the worker's data.
	 */
	public String toString() {
		StringBuffer result = new StringBuffer();
		result.append(this.codWorker);
		result.append(":  ");
		result.append(this.description);
		
		return result.toString();
	}
	
	/**
	 * Updates the worker data.
	 * @param info WorkerInfo, new worker data.
	 */
	public void update(WorkerInfo info) {
		this.setCodWorker(info.getCodWorker());
		this.setDescription(info.getDescription());
	}
	
	/**
	 * Returns tag Id assigned to CVS source file.
	 */
	public static String getRevision() {
		return "$Id: WorkerInfo.java,v 1.1 2008-03-18 12:58:46 mario Exp $";
	}
}
